package lintcode.NO2404;

import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;

/**
 * @Author: zeng
 * @Date: 2025/05/14/17:59
 * @Description:
 **/
public class TestMain2 {
  public static void main(String[] args) {
    Integer[] arr = new Integer[]{2,6,8,6,2,9,5,8,7};
    //使用TreeSet集合去除重复元素并排序,TreeSet集合默认排序且无重复
    Set<Integer> tset = new TreeSet<>();
    for (Integer a:arr) {
      while (!tset.contains(a)){
        tset.add(a);
      }
    }
    Integer[] arr1 = tset.toArray(Integer[]::new);
    System.out.println(Arrays.toString(arr1));
  }
  }
